package com.oywy.rbac.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author oywy
 * @date 2018/10/22
 */
@Controller
public class PageController {
    @GetMapping({"","login","index"})
    public String index() {
        return "/index";
    }
    @GetMapping("admin")
    @PreAuthorize("isAuthenticated()")
    public String main() {
        return "/main";
    }

    @GetMapping("authority/index")
    @PreAuthorize("hasAuthority('authority')")
    public String authority() {
        return "authority/index";
    }

    @GetMapping("user/index")
    @PreAuthorize("hasAuthority('user')")
    public String user() {
        return "user/index";
    }

    @GetMapping("role/index")
    public String page() {
        return "role/index";
    }
}
